﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using Team6_Algorithms.HighEnd;
using Team6_Algorithms.AidingClasses;
using Team6_Algorithms.Operations;

namespace VisionApplication
{
    class DetectLP1 : VisionAlgorithm
    {
        private static object[,] Points;

        public DetectLP1(String name, string[] required) : base(name, required) { }

        public override System.Drawing.Bitmap DoAlgorithm(System.Drawing.Bitmap sourceImage, Object obj)
        {
            Bitmap returnImage = new Bitmap(sourceImage);

            HsvFilter.startExclusionFilter(returnImage, settings.HueLow, settings.HueHigh, settings.SaturationLow, settings.SaturationHigh, settings.LightnessLow, settings.LightnessHigh);

           // Points = HsvFilter.startBinaryImage(returnImage);

          //  HsvFilter.objectsToImage(returnImage, Points);

            Points = Kmeans.start(Points);

           /* Blob blob = BlobDetection.StartGrowing(Points, returnImage);

            int maxX = blob.Pixels.Max(x => x.xPos);
            int maxY = blob.Pixels.Max(x => x.yPos);
            int minX = blob.Pixels.Min(x => x.xPos);
            int minY = blob.Pixels.Min(x => x.yPos);

            PixelPoint min = new PixelPoint(minX, minY, 0, 0, 0, 0, null);
            PixelPoint max = new PixelPoint(maxX, maxY, 0, 0, 0, 0, null);

            DrawRectangles.drawRectangle(sourceImage, min, max);
             */
            this.Image = returnImage;

            return sourceImage; 

        }
    }
}
